/*
 ============================================================================
 Name		: MyS60AlarmForm.cpp
 Author	  : 
 Copyright   : Your copyright notice
 Description : Alarm list
 ============================================================================
 */
//system include
#include <avkon.hrh>
#include <eikedwin.h>
#include <eikdialg.h>

//user include
#include "MyS60Alarm.hrh"
#include "MyS60Alarm.rsg"
#include "MyS60AlarmForm.h"
#include "AlarmObject.h"

// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CMyS60AlarmForm::CMyS60AlarmForm()
// Constructor.
//
// @aAlarmList: listbox
// -----------------------------------------------------------------------------
//
CMyS60AlarmForm::CMyS60AlarmForm(CAknDoubleTimeStyleListBox* aAlarmList)
	{
	iAlarmList = aAlarmList;
	}

CMyS60AlarmForm::~CMyS60AlarmForm()
	{
	}

void CMyS60AlarmForm::ConstructL()
	{
	//no operation needed
	}

void CMyS60AlarmForm::ProcessCommandL( TInt aCommandId )
	{
	return;
	}

TBool CMyS60AlarmForm::OkToExitL(TInt aButtonId)
	{
	switch (aButtonId)
		{
		case EAknSoftkeyOk:
			{
			return SaveFormDataL();
			}
		case EAknSoftkeyBack:
			{
			return QuerySaveChangesL();
			break;
			}
		default:
			{
			return EFalse;
			break;
			}
		}
	}

void CMyS60AlarmForm::PreLayoutDynInitL()
	{
	messageEditor = ( CEikEdwin* ) Control( EAlarmMessageTextEditor );
	
	//get info of current alarm
	TInt currentItemIndex = iAlarmList->CurrentItemIndex();
	TPtrC alarmInfo = iAlarmList->Model()->ItemText(currentItemIndex);
	HBufC* alarmText = alarmInfo.Alloc();
	
/*	
	_LIT(sepratorText, "\t");
	const TDesC* seprator = &sepratorText;
	TPtrC extractedText = alarmInfo;
	
	do
		{
		TInt sepPos = extractedText->Find( *seprator );
		TInt findResult = extractedText.Mid(sepPos);
		}while ( findResult != KErrNotFound);
*/	
	
	messageEditor->SetTextL( alarmText );
	
	}

TBool CMyS60AlarmForm::SavaFormDataL()
	{
	return ETrue;
	}
void CMyS60AlarmForm::DoNotSaveFormDataL()
	{
	
	}

//End of file
